<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include  file="/common/mytags.jsp"%>
<!DOCTYPE html>
<html>
	<head>
	    <title>采购订单状态更新</title>
	    <%@ include file="/common/common_h.jsp" %>
	    <script type="text/javascript">
	    function updatePurState(){
    		$.ajax({
    		    type: "post",
    		    url: "${basePath}supplier/updatePurState.shtml",
    		    data: "FID="+$("#FID").val()+"&ddzt="+$("#ddzt").val()+"&yjfhrq="+$("#yjfhrq").val()+"&wldh="+$("#wldh").val(),
    		    dataType: "json",
    		    success: function(res){
    		    	if(res.success){
    		    		successAlert(res.msg,function(){history.back()});
    		    	}else{
    		    		errorAlert(res.msg);
    		    	}
    		    }
    	    });
	    }
	    </script>
	</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
        	<input type="hidden" value="${pur.FID}" id ="FID">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>采购订单状态更新</h5>
                    </div>
                    <div class="ibox-content">
                    <form class="form-horizontal m-t" id="myForm" method="post">
                    	<div class="row" style="margin-bottom: 5px;">
                    		<div class="col-sm-3">
                    			<label class="col-sm-4 control-label">
                    			<button type="button" class="btn btn-sm btn-white" onclick="history.back()"><i class="fa fa-reply"></i> 返回</button>
                    			</label>
                    			<label class="col-sm-4 control-label">
                    			<button style="float: left" type="button" onclick="updatePurState()" class="btn btn-sm btn-primary"> 保存</button>
                    			</label>
                    		</div>
                    	</div>
                    	<div class="row">
                    		<div class="col-sm-3">
                    			<div class="form-group">
	                                <label class="col-sm-4 control-label">订单编号：</label>
	                                <div class="col-sm-8">
	                                    <p class="form-control-static">${pur.FBILLNO}</p>
	                                </div>
	                            </div>
	                            <div class="form-group">
	                                <label class="col-sm-4 control-label">订单状态：</label>
	                                <div class="col-sm-8">
		                                <select id="ddzt" name="ddzt" class="input-sm form-control input-s-sm inline">
	                                    	<option value="10" <c:if test="${pur.F_PKSD_DDZT == 10}">selected</c:if>>备货</option>
	                                    	<option value="20" <c:if test="${pur.F_PKSD_DDZT == 20}">selected</c:if>>发货</option>
	                                    	<option value="30" <c:if test="${pur.F_PKSD_DDZT == 30}">selected</c:if>>运输</option>
	                                    	<option value="40" <c:if test="${pur.F_PKSD_DDZT == 40}">selected</c:if>>到货</option>
	                                    </select>
	                                </div>
	                            </div>
                    		</div>
                    		<div class="col-sm-3">
                    			<div class="form-group">
	                                <label class="col-sm-4 control-label">采购日期：</label>
	                                <div class="col-sm-8">
	                                    <p class="form-control-static">${pur.FDATE}</p>
	                                </div>
	                            </div>
	                            <div class="form-group">
	                                <label class="col-sm-4 control-label">预计发货日期：</label>
	                                <div class="col-sm-8">
	                                	<input readonly value="${pur.F_PKSD_YJFHRQ}" placeholder="请选择日期" class="form-control input-sm layer-date" id="yjfhrq" name="yjfhrq" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
	                                </div>
	                            </div>
                    		</div>
                    		<div class="col-sm-3">
                    			<div class="form-group">
	                                <label class="col-sm-4 control-label">供应商名称：</label>
	                                <div class="col-sm-8">
	                                    <p class="form-control-static">${pur.SUPPLIER}</p>
	                                </div>
	                            </div>	                            
	                            <div class="form-group">
	                                <label class="col-sm-4 control-label">物流单号信息：</label>
	                                <div class="col-sm-8">
	                                	<input value="${pur.F_PKSD_WLDH}"  id="wldh" name="wldh" >
	                                </div>
	                            </div>
                    		</div>
                    		<div class="col-sm-3">
                    			<div class="form-group">
	                                <label class="col-sm-4 control-label">金额：</label>
	                                <div class="col-sm-8">
	                                    <p class="form-control-static"><fmt:formatNumber value='${pur.FBILLALLAMOUNT}' pattern='#,##.00'/></p>
	                                </div>
	                            </div>
                    		</div>
                    	</div>
                    </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>采购订单分录</h5>
                    </div>
                    <div class="ibox-content">
                    	<div class="table-responsive">
                            <table class="table table-hover table-striped">
                                <thead>
                                    <tr>
                                    	<th>序号</th>
                                        <th>物料名称</th>
                                        <th>规格型号</th>
                                        <th>采购数量</th>
                                        <th>单位</th>
                                        <th>单价</th>
                                        <th>金额</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	<c:forEach items="${pur.entry }" var="entry" varStatus="st">
                                    <tr>
                                        <td>${st.count +(pager.page-1)*pager.pageSize  }</td>
                                        <td>${entry.MATERIALNAME }</td>
                                        <td>${entry.FMODEL }</td>
                                        <td>${entry.FQTY }</td>
                                        <td>${entry.UNIT }</td>
                                        <td><fmt:formatNumber value='${entry.FPRICE}' pattern='#,##.00'/></td>
                                        <td><fmt:formatNumber value='${entry.FENTRYAMOUNT}' pattern='#,##.00'/></td>
                                    </tr>
                                    </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="${basePath }common/hplus/js/content.min.js?v=1.0.0"></script>
    <script src="${basePath }common/hplus/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${basePath }common/hplus/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${basePath }common/hplus/js/plugins/layer/laydate/laydate.js"></script>
</body>

</html>
